Note: This tutorial assumes you have completed previous tutorial [[siemens_cp1616/Tutorials/CP1616 in IO Device mode - Runtime]. |
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
CP1616 in IO Device mode - Alarms
Description: This tutorial teaches you how to send alarm to the IO ControllerTutorial Level: INTERMEDIATE
This tutorial teaches you how to send Diagnostic and Maintenance Alarms to the IO Controller. We recommend using separate computers - one running Linux and second Windows machine with TIA Portal for initial monitoring alarm functionality.
Run the launch file
Run the same launch file as in previous tutorial:
roslaunch siemens_cp1616_io_device_tutorial siemens_cp1616_io_device_tutorial.launch
If initialization succeded, you should notice red error indicators on both PLC and CP1616 turn off and get the following terminal output:
[ INFO]: CP1616 Configuration: Number of modules: 8 [ INFO]: Module: slot 1 sub 1 mod_id 19 sub_id 10001 [ INFO]: Module: slot 2 sub 1 mod_id 22 sub_id 1 [ INFO]: Module: slot 3 sub 1 mod_id 21 sub_id 1 [ INFO]: Module: slot 4 sub 1 mod_id 25 sub_id 1 [ INFO]: Module: slot 5 sub 1 mod_id 24 sub_id 1 [ INFO]: Module: slot 6 sub 1 mod_id 3d sub_id 1 [ INFO]: Module: slot 7 sub 1 mod_id 3c sub_id 1 [ INFO]: Module: slot 8 sub 1 mod_id 20 sub_id 1 [ INFO]: Openning CP1616 in IO_device mode: done [ INFO]: Starting operation: done [ INFO]: Setting device state to PNIO_DEVSTAT_OK: done [ INFO]: Waiting for callbacks... [ INFO]: IO Controller found: plcxb1d0ed IP 192.168.0.20 [ INFO]: New AR from IO controller established [ INFO]: End of CP parametrization [ INFO]: IO Device ready, communication started
Available services
Now check the list of available services:
$ rosservice list
Notice following services in the list:
/set_diag_alarm /set_maint_alarm /reset_diag_alarm /reset_maint_alarm
You can call set/reset services to send diagnostic and maitenance alarms to the IO Controller.
Set Diagnostic Alarm
"slot_num" is the only parameter that needs to be specified when sending Diagnostic Alarm to the IO Controlelr. In this tutorial example slots 1-8 are deffined, so choose slot number within this range. To test diagnostic alarm functionality you can use a command line tool:
$ rosservice call /set_diag_alarm 2
"slot_num" parameter provides additional information to the IO Controller about which module/transfer_area/slot caused the alarm. You should see following terminal output from the wrapper node:
[ WARN] : Sending diagnostic alarm to IO Controller [ INFO] : Diagnostic alarm sent to the IO Controller [ INFO] : IO Controller confirmed alarm: UserHndl: 0x1234
Also notice that "ERROR" LED indicator on PLC turned red. Diagnostic alarm can also be seen in PLC "Diagnostic buffer":
NOTE: Module is selected from the Transfer area list according to the slot_num parameter.
Reset Diagnostic Alarm
Specifying the same slot_num, to reset diagnostic alarm use following command line tool:
$ rosservice call /reset_diag_alarm 2
Wrapper node should respond:
[ INFO] : Reseting the diagnostic alarm... [ INFO] : IO Controller confirmed alarm: UserHndl: 0x1234
PLC should return back to RUN state.
Set Maintenance Alarm
To send maintenance alarm to the IO Controller no parameter needs to be specified:
$ rosservice call /set_maint_alarm
You should see following terminal output from the wrapper node:
[ WARN] : Sending maintenance alarm to IO Controller [ INFO] : Maintenance alarm sent to the IO Controller [ INFO] : IO Controller confirmed alarm: UserHndl: 0x1234
Also notice that "MAINT" LED indicator on PLC turned yellow. Maintenance alarm can also be seen in PLC "Diagnostic buffer":
Reset Maintenance Alarm
To reset maintenance alarm use following command line tool:
$ rosservice call /reset_maint_alarm
Wrapper node should respond:
[ INFO] : Reseting the maintenance alarm... [ INFO] : IO Controller confirmed alarm: UserHndl: 0x1234
PLC should return back to RUN state.